From 760e60fa0487ded9b053ccd94200582cc24e52db Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Apr 2021 20:00:49 -0400 Subject: [PATCH] window: Fix up resize borders The invisible resize borders have been wider than they should, for a while. Go back to a size close to what we have in GTK3. To summarize: resize borders will be at most 12 pixels on each size, but never wider than the windows shadow. The resize corners have 'legs' of 24 pixels where you still get a corner resize cursor. Fixes: #3856 --- gtk/gtkwindow.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 17beb19fa3..2270690357 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -148,7 +148,8 @@ */ #define MENU_BAR_ACCEL GDK_KEY_F10 -#define RESIZE_HANDLE_SIZE 20 +#define RESIZE_HANDLE_SIZE 12 /* Width of resize borders */ +#define RESIZE_HANDLE_CORNER_SIZE 24 /* How resize corners extend */ #define MNEMONICS_DELAY 300 /* ms */ #define NO_CONTENT_CHILD_NAT 200 /* ms */ #define VISIBLE_FOCUS_DURATION 3 /* s */ @@ -1389,10 +1390,10 @@ get_edge_for_coordinates (GtkWindow *window, if (x < left && x >= left - handle_size.left) { - if (y < top + handle_size.top && y >= top - handle_size.top) + if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST); - if (y > top + border_rect->size.height - handle_size.bottom && + if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE && y <= top + border_rect->size.height + handle_size.bottom) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST); @@ -1401,10 +1402,10 @@ get_edge_for_coordinates (GtkWindow *window, else if (x > left + border_rect->size.width && x <= left + border_rect->size.width + handle_size.right) { - if (y < top + handle_size.top && y >= top - handle_size.top) + if (y < top + RESIZE_HANDLE_CORNER_SIZE && y >= top - handle_size.top) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST); - if (y > top + border_rect->size.height - handle_size.bottom && + if (y > top + border_rect->size.height - RESIZE_HANDLE_CORNER_SIZE && y <= top + border_rect->size.height + handle_size.bottom) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST); @@ -1412,10 +1413,10 @@ get_edge_for_coordinates (GtkWindow *window, } else if (y < top && y >= top - handle_size.top) { - if (x < left + handle_size.left && x >= left - handle_size.left) + if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST); - if (x > left + border_rect->size.width - handle_size.right && + if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE && x <= left + border_rect->size.width + handle_size.right) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST); @@ -1424,10 +1425,10 @@ get_edge_for_coordinates (GtkWindow *window, else if (y > top + border_rect->size.height && y <= top + border_rect->size.height + handle_size.bottom) { - if (x < left + handle_size.left && x >= left - handle_size.left) + if (x < left + RESIZE_HANDLE_CORNER_SIZE && x >= left - handle_size.left) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST); - if (x > left + border_rect->size.width - handle_size.right && + if (x > left + border_rect->size.width - RESIZE_HANDLE_CORNER_SIZE && x <= left + border_rect->size.width + handle_size.right) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST); -- 2.30.2